package com.bestcem.xm.qdes.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum QuestionDescTypeEnum {

    QUESTION_TYPE_SINGLE("single", "single", "单选题"),
    QUESTION_TYPE_MULTIPLE("multiple", "multiple","多选题"),
    QUESTION_TYPE_BLANK("blank", "blank", "填空题"),
    QUESTION_TYPE_TIMEDELTA("timedelta", "info_time", "时间"),
    QUESTION_TYPE_TIMESTAMP("timestamp", "info_date", "日期"),
    QUESTION_TYPE_MULTIPLE_BLANK("multiple_blank", "multiple_blank","多项填空题"),
    QUESTION_TYPE_MATRIX_SINGLE("matrix_single", "matrix_single", "矩阵单选题"),
    QUESTION_TYPE_MATRIX_MULTIPLE("matrix_multiple", "matrix_multiple", "矩阵多选题"),
    QUESTION_CUSTOM_TYPE_MATRIX_MULTIPLE_CLASSIFY("matrix_multiple", "classify", "分类题"),
    QUESTION_TYPE_MATRIX_SCORE("matrix_score", "matrix_score", "矩阵打分题"),
    QUESTION_TYPE_MATRIX_BLANK("matrix_blank", "matrix_blank", "矩阵填空题"),
    QUESTION_TYPE_ORDER("sort", "sort", "排序题"),
    QUESTION_TYPE_SCORE("score", "star_score", "打分题"),
    QUESTION_CUSTOM_TYPE_SCORE_NPS_SCORE("score", "nps", "NPS题"),
    QUESTION_CUSTOM_TYPE_SCORE_CURSOR_SCORE("score", "cursor_score","游标打分题"),
    QUESTION_TYPE_CITY("city", "city", "城市"),
    QUESTION_TYPE_CASCADE("cascader", "cascader", "级联题"),
    QUESTION_TYPE_GEO("geo", "info_geography", "地理位置题"),
    QUESTION_TYPE_EVALUATION("evaluation", "evaluation", "评价题"),
    QUESTION_TYPE_AUTOTABLE("auto_table", "auto_table", "自增表格题"),
    QUESTION_TYPE_PROPORTION("proportion", "proportion", "比重题"),
    QUESTION_TYPE_DESC("descriptor", "descriptor", "描述题"),

    QUESTION_CUSTOM_TYPE_BLANK_USERNAME("blank", "info_username", "姓名"),
    QUESTION_CUSTOM_TYPE_BLANK_EMAIL("blank", "info_email", "邮箱"),
    QUESTION_CUSTOM_TYPE_BLANK_PHONE("blank", "info_phone", "手机"),
    QUESTION_CUSTOM_TYPE_SINGLE_GENDER("single", "info_sex", "性别"),
    QUESTION_CUSTOM_TYPE_SINGLE_AGE("single", "info_age", "年龄"),
    QUESTION_CUSTOM_TYPE_SINGLE_EDUCATION("single", "info_education", "学历"),
    QUESTION_CUSTOM_TYPE_SINGLE_OCCUPATION("single",  "info_occupation", "职业");

    @EnumValue
    private final String dispType;
    private final String customQtype;
    private final String desc;

    public static Optional<QuestionDescTypeEnum> getOneQuestionDescType(String desc) {
        return Arrays.stream(QuestionDescTypeEnum.values()).filter(questionDescTypeEnum ->
        desc.equals(questionDescTypeEnum.getDesc())).findFirst();
    }
}
